<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Mixin: Triggers</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Mixin: Triggers</h1>

    




<section>

<header>
    
        <h2>Triggers</h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        
            <div class="description">Provides trigger functionality methods.</div>
        

        


<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line9">line 9</a>
    </li></ul></dd>
    

    

    

    
</dl>


        
    
    </div>

    

    

    

     

    

    
            <h3 class="subsection-title">Methods</h3>

            <ul><li><a href="#addLinkIO"><span class="type-signature">(static) </span>addLinkIO<span class="signature">(id, ioData)</span><span class="type-signature"></span></a></li><li><a href="#addTrigger"><span class="type-signature">(static) </span>addTrigger<span class="signature">(id, type, phase, method)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#ignoreTriggers"><span class="type-signature">(static) </span>ignoreTriggers<span class="signature">(val)</span><span class="type-signature"> &rarr; {*}</span></a></li><li><a href="#processTrigger"><span class="type-signature">(static) </span>processTrigger<span class="signature">(operation, type, phase, oldDoc, newDoc)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#removeLinkIO"><span class="type-signature">(static) </span>removeLinkIO<span class="signature">(id)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#removeTrigger"><span class="type-signature">(static) </span>removeTrigger<span class="signature">(id, type, phase)</span><span class="type-signature"> &rarr; {boolean}</span></a></li><li><a href="#willTrigger"><span class="type-signature">(static) </span>willTrigger<span class="signature">(type, phase)</span><span class="type-signature"> &rarr; {Boolean}</span></a></li></ul>

            
                

    

    <h4 class="name" id=".addLinkIO"><span class="type-signature">(static) </span>addLinkIO<span class="signature">(id, ioData)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Generates triggers that fire in the after phase for all CRUD ops
that automatically transform data back and forth and keep both
import and export collections in sync with each other.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The unique id for this link IO.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ioData</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The settings for the link IO.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line100">line 100</a>
    </li></ul></dd>
    

    

    

    
</dl>
















            
                

    

    <h4 class="name" id=".addTrigger"><span class="type-signature">(static) </span>addTrigger<span class="signature">(id, type, phase, method)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Add a trigger by id, type and phase.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The id of the trigger. This must be unique to the type and
phase of the trigger. Only one trigger may be added with this id per type and
phase.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>type</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Constants.html">Constants</a></span>


            
            </td>

            

            

            <td class="description last">The type of operation to apply the trigger to. See
Mixin.Constants for constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>phase</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Constants.html">Constants</a></span>


            
            </td>

            

            

            <td class="description last">The phase of an operation to fire the trigger on. See
Mixin.Constants for constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>method</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Triggers.html#.addTriggerCallback">Triggers.addTriggerCallback</a></span>


            
            </td>

            

            

            <td class="description last">The method to call when the trigger is fired.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line10">line 10</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    True if the trigger was added successfully, false if not.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



            
                

    

    <h4 class="name" id=".ignoreTriggers"><span class="type-signature">(static) </span>ignoreTriggers<span class="signature">(val)</span><span class="type-signature"> &rarr; {*}</span></h4>

    



<div class="description">
    Tells the current instance to fire or ignore all triggers whether they
are enabled or not.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>val</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last">Set to true to ignore triggers or false to not
ignore them.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line84">line 84</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">*</span>


    </dd>
</dl>

    



            
                

    

    <h4 class="name" id=".processTrigger"><span class="type-signature">(static) </span>processTrigger<span class="signature">(operation, type, phase, oldDoc, newDoc)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Processes trigger actions based on the operation, type and phase.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>operation</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">Operation data to pass to the trigger.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>type</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The type of operation. See Mixin.Constants for
constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>phase</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The phase of the operation. See Mixin.Constants
for constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>oldDoc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The document snapshot before operations are
carried out against the data.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>newDoc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The document snapshot after operations are
carried out against the data.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line509">line 509</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



            
                

    

    <h4 class="name" id=".removeLinkIO"><span class="type-signature">(static) </span>removeLinkIO<span class="signature">(id)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Removes a previously added link IO via it's ID.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The id of the link IO to remove.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line237">line 237</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    True if successful, false if the link IO
was not found.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



            
                

    

    <h4 class="name" id=".removeTrigger"><span class="type-signature">(static) </span>removeTrigger<span class="signature">(id, type, phase)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Removes a trigger by id, type and phase.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">The id of the trigger to remove.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>type</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The type of operation to remove the trigger from. See
Mixin.Constants for constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>phase</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The phase of the operation to remove the trigger from.
See Mixin.Constants for constants to use.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line51">line 51</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    True if removed successfully, false if not.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



            
                

    

    <h4 class="name" id=".willTrigger"><span class="type-signature">(static) </span>willTrigger<span class="signature">(type, phase)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    Checks if a trigger will fire based on the type and phase provided.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>type</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The type of operation. See Mixin.Constants for
constants to use.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>phase</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The phase of the operation. See Mixin.Constants
for constants to use.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line480">line 480</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    True if the trigger will fire, false otherwise.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



            
        

    


    
        <h3 class="subsection-title">Type Definitions</h3>

        
                

    

    <h4 class="name" id=".addTriggerCallback"><span class="type-signature"></span>addTriggerCallback<span class="signature">(operation, oldDoc, newDoc)</span><span class="type-signature"></span></h4>

    



<div class="description">
    When called in a before phase the newDoc object can be directly altered
to modify the data in it before the operation is carried out.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>operation</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The details about the operation.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>oldDoc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The document before the operation.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>newDoc</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">The document after the operation.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line643">line 643</a>
    </li></ul></dd>
    

    

    

    
</dl>
















            
    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ActiveBucket.html">ActiveBucket</a></li><li><a href="Angular.html">Angular</a></li><li><a href="AutoBind.html">AutoBind</a></li><li><a href="Collection.html">Collection</a></li><li><a href="CollectionGroup.html">CollectionGroup</a></li><li><a href="Condition.html">Condition</a></li><li><a href="Core.html">Core</a></li><li><a href="Db.html">Db</a></li><li><a href="Document.html">Document</a></li><li><a href="Grid.html">Grid</a></li><li><a href="Highchart.html">Highchart</a></li><li><a href="Index2d.html">Index2d</a></li><li><a href="IndexBinaryTree.html">IndexBinaryTree</a></li><li><a href="IndexHashMap.html">IndexHashMap</a></li><li><a href="Infinilist.html">Infinilist</a></li><li><a href="KeyValueStore.html">KeyValueStore</a></li><li><a href="Metrics.html">Metrics</a></li><li><a href="MyModule.html">MyModule</a></li><li><a href="NodeApiClient.html">NodeApiClient</a></li><li><a href="NodeApiServer.html">NodeApiServer</a></li><li><a href="NodeRAS.html">NodeRAS</a></li><li><a href="Odm.html">Odm</a></li><li><a href="OldView.html">OldView</a></li><li><a href="Operation.html">Operation</a></li><li><a href="Overload.html">Overload</a></li><li><a href="Overview.html">Overview</a></li><li><a href="Overview_init.html">init</a></li><li><a href="Path.html">Path</a></li><li><a href="Persist.html">Persist</a></li><li><a href="Procedure.html">Procedure</a></li><li><a href="ReactorIO.html">ReactorIO</a></li><li><a href="Section.html">Section</a></li><li><a href="Serialiser.html">Serialiser</a></li><li><a href="Shared.overload.html">overload</a></li><li><a href="View.html">View</a></li></ul><h3>Mixins</h3><ul><li><a href="ChainReactor.html">ChainReactor</a></li><li><a href="Common.html">Common</a></li><li><a href="Constants.html">Constants</a></li><li><a href="Events.html">Events</a></li><li><a href="Matching.html">Matching</a></li><li><a href="Shared.html">Shared</a></li><li><a href="Sorting.html">Sorting</a></li><li><a href="Tags.html">Tags</a></li><li><a href="Triggers.html">Triggers</a></li><li><a href="Updating.html">Updating</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 01 2018 11:34:23 GMT+0000 (GMT)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>